/**
 * 指标卡
 * @params datasets 数据
 */
export function cardFormat(datasets) {
  const { source, type, dimensions = undefined } = datasets;
  let seriesData = [];
  if(type === 'STATIC') {
    seriesData = source;
  }else{
    source.length && (seriesData = source.map((item) => ({
      xAxis: item[dimensions.xAxis],
      yAxis: dimensions.yAxis,
      value: item[dimensions.yAxis],
    })));
  }
  return {
    formatData: seriesData,
  };
}
